Skip to content

Throttle playback progress publishers to reduce UI lag#1510

Open
matalvernaz wants to merge 1 commit intoTortugaPower:developfrom
matalvernaz:fix/playback-ui-throttle
Open

Throttle playback progress publishers to reduce UI lag#1510
matalvernaz wants to merge 1 commit intoTortugaPower:developfrom
matalvernaz:fix/playback-ui-throttle

Conversation

@matalvernaz
Copy link
Copy Markdown
Contributor

Summary

Fixes #1509

  • Adds 500ms throttle to .bookPlaying and .listeningProgressChanged subscribers in PlayerViewModel (keeps slider updates smooth while halving redraws)
  • Adds 1s throttle to currentProgressPublisher and immediateProgressUpdatePublisher in ItemProgressView (matches the existing folderProgressUpdated throttle)

Context

The AVPlayer periodic time observer fires every 1 second. Without throttling, each tick triggers recalculateProgress() (updating ~6 @Published properties) and redraws every visible library row's progress ring. On lower-powered devices like the iPhone SE 2, this causes noticeable lag during playback.

Test plan

  • Play an audiobook and verify the player slider/time labels still update smoothly
  • Verify library list progress rings still update during playback
  • Verify no visual stutter when scrolling the library during playback
  • Test on a lower-powered device (iPhone SE 2 / similar) if available

🤖 Generated with Claude Code

The .bookPlaying and .listeningProgressChanged notifications fire every
second from the AVPlayer periodic time observer, causing recalculateProgress()
to update multiple @published properties on every tick. Similarly,
currentProgressPublisher and immediateProgressUpdatePublisher in
ItemProgressView trigger per-second redraws for every visible library row.

On lower-powered devices (e.g. iPhone SE 2), this causes noticeable UI lag
during playback. This adds 500ms throttling on the player progress publishers
(keeping slider updates smooth) and 1s throttling on the library progress
views (matching the existing folderProgressUpdated throttle).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UI lag during playback on lower-powered devices (iPhone SE 2)

1 participant